<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:chart="http://schemas.Kherty.com/office/2007/chart"
  xmlns:chartui="clr-namespace:OpenLS.Chart.UI"
  xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
  xmlns:Internals="clr-namespace:OpenLS.Chart.UI.Internals"  
  x:Class="OpenLS.Chart.UI.LineSeriesResources"
    >
  <ResourceDictionary.MergedDictionaries>
    <chartui:ChartHelperResources/>
  </ResourceDictionary.MergedDictionaries>

    <DataTemplate DataType="{x:Type chart:LineSeries}" >
        <Grid Name="grid" chartui:SeriesElement.Series="{Binding}"
                                >
            <Grid.CommandBindings>
                <CommandBinding Command="{x:Static chartui:ChartCommands.FormatDataSeries}" Executed="OnFormatLineSeries"/>
            </Grid.CommandBindings>
            <Path StrokeThickness="{Binding ShapeProperties.LineProperties.Width, FallbackValue=3}"
                  Name="linePath" Internals:FormatHelper.HandlesChartCommands="True"
                  Style="{x:Static chartui:ShapedObjectResources.ShapedObjectStyle}"
                 >
               <Path.Data>
                    <MultiBinding Converter="{x:Static Internals:ChartConverters.LineSeriesToGeometryConverter}" >
                        <Binding/>
                        <Binding Path="(chartui:ChartElement.Chart)" RelativeSource="{RelativeSource Self}"/>
                        <Binding Path="ActualWidth" ElementName="grid"/>
                        <Binding Path="ActualHeight" ElementName="grid"/>
                        <Binding Path="(chartui:ChartElement.YAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
                        <Binding Path="(chartui:ChartElement.YAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
                        <Binding Path="(chartui:ChartElement.Chart).ValueAxis.Orientation" RelativeSource="{RelativeSource Self}"/>
                        <Binding Path="(chartui:ChartElement.Chart).HorizontalAxis.Orientation" RelativeSource="{RelativeSource Self}"/>
                        <Binding Path="IsSmooth"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.Observer).MaxIndex"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.Observer).Generation"/>
                    </MultiBinding>
                </Path.Data>
                <Path.Stroke>
                    <MultiBinding Converter="{x:Static  Internals:ChartConverters.LineFillPropertiesSchemeIndexToBrushConverter}">
                        <Binding Path="ShapeProperties.LineProperties.LineFillProperties"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                        <Binding Path="Index"/>
                    </MultiBinding>
                </Path.Stroke>
                <Path.ContextMenu>
                    <ContextMenu>
                        <MenuItem Command="{x:Static chartui:ChartCommands.UnformatDataSeries}"/>
                        <MenuItem Command="{x:Static chartui:ChartCommands.AddTitle}" />
                        <MenuItem Command="{x:Static chartui:ChartCommands.AddLegend}" />
                        <MenuItem Command="{x:Static chartui:ChartCommands.AddDataLabels}"/>
                        <MenuItem Command="{x:Static chartui:ChartCommands.FormatDataLabels}" />
                        <MenuItem Command="{x:Static chartui:ChartCommands.FormatDataSeries}" CommandParameter="{Binding}"/>
                    </ContextMenu>
                </Path.ContextMenu>
            </Path>
            <ItemsControl Name="markers" ItemTemplate="{x:Static chartui:MarkerResources.NumericMarkerTemplate}"
                          drawing2:DrawingElement.ShapeProperties="{Binding Marker.ShapeProperties, FallbackValue={x:Null}}"
                          chartui:SeriesElement.Marker="{Binding Marker}"
                          >
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Internals:LinePanel 
                            CategoryOrientation="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.Chart).HorizontalAxis.Orientation}"
                            ValueOrientation="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.Chart).VerticalAxis.Orientation}"
                            chartui:SeriesElement.MaximumIndex="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.Observer).MaxIndex}"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property="chartui:SeriesElement.Value" Value="{Binding Value}"/>
                        <Setter Property="chartui:SeriesElement.Index" Value="{Binding Index}"/>
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.Chart).Marker}" Value="True">
                <Setter TargetName="markers" Property="ItemsSource">
                    <Setter.Value>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.ValueThrottlingConverter}" >
                            <Binding Path="Values.Values"/>
                            <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                        </MultiBinding>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>


</ResourceDictionary>